<template>
  <div class="cart py-container">
    <!--主内容-->
    <div class="checkout py-container pay">
      <div class="checkout-tit">
        <h4 class="fl tit-txt"><span class="success-icon"></span><span
          class="success-info">订单提交成功，请您及时付款！订单号：{{ natvie.orderId }}</span>
        </h4>
        <span class="fr"><em class="sui-lead">应付金额：</em><em class="orange money">￥{{ natvie.total_fee }}</em></span>
        <div class="clearfix"></div>
      </div>
      <div class="checkout-steps">
        <div class="fl weixin">微信支付</div>
        <div class="fl sao">
          <p class="red">请使用微信扫一扫。</p>
          <div class="fl code">
            <!--             <img id="qrious" src="~/assets/img/erweima.png" alt="">-->
            <qriously value="weixin://wxpay/bizpayurl?pr=UB8rdlE" :size="338"/>

            <!--            <div class="saosao">-->
            <!--              <p>请使用微信扫一扫</p>-->
            <!--              <p>扫描二维码支付</p>-->
            <!--            </div>-->
          </div>
        </div>
        <div class="clearfix"></div>
        <p><a href="pay.html" target="_blank">> 其他支付方式</a></p>
      </div>
    </div>
  </div>
</template>

<script>

import order from "../../api/order/order";

export default {
  name: "_pid",

  data() {
    return {
      natvie: '',
      time: ''
    }
  },
  //页面渲染之前执行
  created() {

    this.createNatvie();

  },
  //页面渲染之后执行
  mounted() {
    this.time = setInterval(() => {
      this.queryOrderStatus(this.$route.params.pid)
    }, 3000)
  },

  methods: {

    createNatvie() {
      order.createNatvie(this.$route.params.pid).then(response => {
        this.natvie = response.data.data
        console.log("fda", response)
      })
    },

    queryOrderStatus(orderId) {
      order.getOrder(orderId).then(response => {
        console.log("查询状态",response)
        console.log("params.pid",this.$route.params.pid)
        console.log("params",this.$route.params)

        //  支付成功清除定时器
        clearInterval(this.time)

        //  提示
        this.$message({
          type: 'success',
          message: '支付成功'
        })

        this.$router.push({path: '/automobile/' + this.natvie.course_id})
      })
    }

  }


}
</script>

<style scoped>

</style>
